
import ls from '@/lib/script/storage'

class metadata {
  metadata: any = null;

  getMetadata(){
    this.metadata = ls.getItem('monitoring_background_metadata');
  }

  getUser(){
    if(!this.metadata){
      this.getMetadata()
    }
    return this.metadata.user || null;
  }
  getToken(refresh?: boolean){
    if(!this.metadata){
      this.getMetadata()
    }
    return refresh ? this.metadata?.refreshToken : this.metadata?.token;
  }
}

export default new metadata();